package com.tencent.wxcloudrun.service;

import com.alibaba.fastjson2.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tencent.wxcloudrun.dao.GoodsMapper;
import com.tencent.wxcloudrun.dao.OrderGoodsMapper;
import com.tencent.wxcloudrun.model.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * ClassName: GoodsService
 * Package: com.tencent.wxcloudrun.service
 * Description:
 *
 * @Date: 2023/1/23 2:04 PM
 * @Author: wht
 */
@Slf4j
@Service
public class OrderGoodsService {
    @Autowired
    OrderGoodsMapper orderGoodsMapper;


    public PageInfo getOrderGoodsList(OrderGoodsReq req) {
        PageHelper.startPage(req.getPageNum(), req.getPageSize());
        PageHelper.orderBy("id");
        List<PayReq> orderGoodsList = orderGoodsMapper.getOrderGoodsList(req);
        PageInfo<PayReq> pageInfo = new PageInfo<>(orderGoodsList);
        return pageInfo;
    }

    public List<PayReq> getOrderGoodsShow(Integer shop_id) {
        List<PayReq> res = orderGoodsMapper.getOrderGoodsShow(shop_id);
        return res;
    }

    public void updateOrderGoodsStatus(Integer id, Integer status) {
        orderGoodsMapper.updateOrderGoodsStatus(id, status);
    }

}
